# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=libpfring
pkgver=7.6.0.r48.gb5d63335
pkgrel=1
epoch=2
pkgdesc='Library to interface with the PF_RING kernel module.'
url='https://github.com/ntop/PF_RING'
arch=('x86_64' 'aarch64')
license=('LGPL')
depends=('numactl' 'pfring-dkms')
makedepends=('binutils' 'bison' 'flex' 'git' 'linux-headers' 'make' 'libpcap')
options=('staticlibs')
source=("$pkgname::git+https://github.com/ntop/PF_RING.git#branch=7.6.0-stable")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd "$pkgname/userland/lib"

  ./configure --disable-bpf --prefix=/usr --libdir=/usr/lib/libpfring \
    --includedir=/usr/include/pfring

  make
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/etc/ld.so.conf.d/"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" doc/README.md \
    doc/hugepages.rst
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  echo "/usr/lib/$pkgname" > "$pkgdir/etc/ld.so.conf.d/$pkgname.conf"

  cd "userland/lib"

  make DESTDIR="$pkgdir" install
}

